# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Contributor: mio <miyopan@e.email>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=pilot-link
pkgver=0.12.5_git20240103
_commit="14338868111ce592c7ca7918a1f8a32ceecb7caf"
pkgrel=1
pkgdesc="A suite of tools for connecting to PalmOS handheld devices"
url="https://github.com/desrod/pilot-link"
license="GPL-2.0-only"
arch="all !s390x"
makedepends="
	libtool
	autoconf
	automake
	bison
	popt-dev
	bluez-dev
	libpng-dev
	libusb-dev
	readline-dev
	linux-headers
	gnu-libiconv-dev
	libxslt
	docbook-xml
	docbook-xsl
	"
source="${pkgname}_$_commit.tar.gz::https://github.com/desrod/pilot-link/archive/$_commit.tar.gz
	config.guess
	config.sub
	pilot-link-png14.patch
	fix-printf-string-literals.patch
	fix-configure-checks.patch
	fix-doc-generation.patch
	gcc14.patch
	"
builddir="$srcdir/$pkgname-$_commit"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs"

prepare() {
	cp "$srcdir/config.guess" "$builddir/"
	cp "$srcdir/config.sub" "$builddir/"
	default_prepare
	update_config_sub
	update_config_guess
}

build() {
	./autogen.sh \
			--prefix=/usr \
			--enable-conduits \
			--enable-libusb \
			--with-libiconv \
			--with-libpng

	make

	#Build man pages
	cd "$builddir/doc/xml"
	LIBXSLTPROC="xsltproc" make
}

check() {
	make check
}

package() {
	depends="$pkgname-libs"
	make DESTDIR="$pkgdir" install

	cd "$builddir/doc/man"
	make DESTDIR="$pkgdir" install
}

sha512sums="
0822ec4b6c94248b36d01d6e0f3de5ee4922c1ca9011c24171c6dce76d722b24ad8347d1a90aab86cbe9c192a7380b9a11540c42333c3500260b03c86e2038bf  pilot-link_14338868111ce592c7ca7918a1f8a32ceecb7caf.tar.gz
e9a80021a526299995e21094d76810a21d3982c00020f13a3c7527ba2b83459863f4f8eeb3b1ee7a4f1e2ff6c51d7b5e8ae2a6ce719392cf676ae848599117b3  config.guess
0ec40128c1ef50e47432ee4ebbb4ea6d2feaa411ff518626c4181b0302c5d0ff4095aaf36e433a216ce1bd5bb03ba416645a46ef3c916718761f9a21f5bdcbfd  config.sub
cf37e4b51d261431f42054cf05d1603e66d8eca0604ae042371c7284c8e668f49cadb3d75cf67eaf56008809d3cc2766615105658293a90cada37bdf3f553f41  pilot-link-png14.patch
359cf02da308bbd9d24716ac022738598de03befd18932ba1f827e51320650ed36da5fcd203a4adaa8d04a98d4f84aac61e594320af1fc316873a9c06d1fb147  fix-printf-string-literals.patch
f68d98c4cc458cc5c030af2c8bcb9e9cffda1408b3fa0b9f4679098123fe11a63a92f222cb2a7f6195f130201f293dbd5fee5b84ec65f22ac09f33e43448ffe8  fix-configure-checks.patch
6175ddb5e1b454c83fbf09b0ec4dc690ce2125288de19e5183dc6554b1a865a3351367e4b2c45905ee3a3c5e0d3013dec69840495cef8e1d23036a73bfed2bb4  fix-doc-generation.patch
e64519f9e60d66d4831f92e1523fbd11a1e6c8da644e019430d0d9b203a4211726bc6ddf40d7584eda444146559f17e32ef6a63e526ce4c954acb5a69d19bbe7  gcc14.patch
"
